const Core = require('@alicloud/pop-core');

var client = new Core({
  accessKeyId: 'LTAI5tSetNK3GBhjSHZLeQPv',
  accessKeySecret: 'ug0gQOV86wqBAqa3zINcdCkS3RKxvu',
  // securityToken: '<your-sts-token>', // use STS Token
  endpoint: 'https://dysmsapi.aliyuncs.com',
  apiVersion: '2017-05-25'
});

module.exports = async (phone,code) => {
    var params = {
        TemplateParam: `{"code":"${code}"}`,
        PhoneNumbers: phone,
        TemplateCode:'SMS_201481600',
        SignName: '小朱博客'
    }
    var requestOption = {
        method: 'POST'
    };
    
    const result = await client.request('SendSms', params, requestOption)
    return result.Code == 'OK'
}